-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always use designtime document for formatting with FUSE #10640
Always use designtime document for formatting with FUSE #10640
Conversation
@@ -261,284 +260,48 @@ internal static ImmutableArray<IDocumentSnapshot> GetImportsCore(IProjectSnapsho | |||
return imports.ToImmutable(); | |||
} | |||
|
|||
// Internal, because we are temporarily sharing code with CohostDocumentSnapshot | |||
internal class ComputedStateTracker | |||
internal static async Task<RazorCodeDocument> GenerateCodeDocumentAsync(ImmutableArray<TagHelperDescriptor> tagHelpers, RazorProjectEngine projectEngine, IDocumentSnapshot document, ImmutableArray<ImportItem> imports, bool forceRuntimeCodeGeneration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved stuff around but I'm not totally happy with how it ended up. Maybe it's time to move these into a static class on their own?
Integration test run https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9900455&view=results |
.../Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.ComputedStateTracker.cs
Show resolved
Hide resolved
@@ -59,4 +59,30 @@ public static bool IsPathCandidateForComponent(this IDocumentSnapshot documentSn | |||
var fileName = Path.GetFileNameWithoutExtension(documentSnapshot.FilePath); | |||
return fileName.AsSpan().Equals(path.Span, FilePathComparison.Instance); | |||
} | |||
|
|||
public static Task<RazorCodeDocument> GetFormatterCodeDocumentAsync(this IDocumentSnapshot documentSnapshot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this take a CancellationToken
and pass it to GetDesignTimeDocumentAsync(...)
and then into project.GetTagHelpersAsync(...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of the stack this depends on doesn't currently take cancellation tokens. I think they should so I'll file a tech debt issue.
.../Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.ComputedStateTracker.cs
Show resolved
Hide resolved
internal partial class DocumentState | ||
{ | ||
// Internal, because we are temporarily sharing code with CohostDocumentSnapshot | ||
private class ComputedStateTracker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this green made me remember how much I hate how confusing ComputedStateTracker
is and how much I want to rewrite it. Sigh... MUST RESIST BEING NERD-SNIPED. 😁
...r/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
.../Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.ComputedStateTracker.cs
Outdated
Show resolved
Hide resolved
…ystem/DocumentState.ComputedStateTracker.cs
…Formatting_NetFx/FormattingTestBase.cs Co-authored-by: Dustin Campbell <[email protected]>
Separated commits to functional change and code moving. This moves the feature flag check into tooling instead of relying on the compiler to know and generate documents differently.
That also allows for correctly doing document generation of designtime/runtime from the tooling side. If FUSE is enabled tooling will use runtime in all places except formatting. This is to keep formatting working as it does today without FUSE and start A/B testing faster.